//
//  LibraryCollectionViewCell.m
//  objective_c_language
//
//  Created by 王玉龙 on 2018/6/8.
//  Copyright © 2018年 longlong. All rights reserved.
//

#import "LibraryCollectionViewCell.h"
#import <Masonry.h>

@interface LibraryCollectionViewCell()

{
    
}

@property (nonatomic ,strong) UIImageView *imageView;

@end


@implementation LibraryCollectionViewCell


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    
    if (self)
    {
        [self.contentView addSubview:self.imageView];
        [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.contentView);
        }];
        self.layer.masksToBounds=YES;

    }
    return self;
}



- (void)setImageAsset:(PHAsset *)imageAsset
{
    _imageAsset = imageAsset;
    PHImageManager *imageManager = [PHImageManager defaultManager];
    [imageManager requestImageForAsset:imageAsset targetSize:CGSizeMake(150, 150) contentMode:PHImageContentModeAspectFit options:nil resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info)
     {
         self.imageView.image = result;
     }];
}

- (UIImageView *)imageView
{
    if (_imageView == nil)
    {
        _imageView = [[UIImageView alloc] init];
        _imageView.contentMode = UIViewContentModeScaleAspectFill;
    }
    return _imageView;
}

//- (UILabel *)textLable
//{
//    if (_textLable == nil)
//    {
//        UILabel *lable = [[UILabel alloc] init];
//        lable.textColor = COLOR_VALUE(0x333333, 1);
//        lable.font = [UIFont systemFontOfSize:16];
//
//        _textLable = lable;
//    }
//    return _textLable;
//}


@end
